<layout name="layout" />
                <div class="page-header"><!-- Page header -->
                    <h5><i class="font-home"></i>添加数据调用</h5>
                </div><!-- /page header -->
                <div class="body">                
                    <!-- Content container -->
                    <div class="container"> 
                	
                        <!-- Site Summary -->
                        <div class="block well">                	
    	
<div class="table-overflow">
<FORM METHOD=POST id="form1" action="{:U('Admin/Datacall/insert')}">	
<TABLE class="table table-bordered table-block tableform">
<TR>  
	<TH width="20%">调用名称：</TH> 
	<TD><INPUT TYPE="text" class="input-xxlarge input-require" NAME="title" value="{$vo.title}"></TD>
</TR>	
<TR>  
	<TH>调用代码：</TH> 
	<TD><INPUT TYPE="text" class="callcode input-xxlarge input-require" NAME="callcode" value="{$vo.callcode}"></TD>
</TR>	
<TR>  
	<TH>调用方式：</TH> 
	<TD class="callmethod">&lt;datacall:html code="{$vo.callcode}" /&gt;</TD>
</TR>
<TR>
	<TH>调用类型：</TH>
	<TD><select name="calltype" onchange="setCallType(this.value);" class="calltype input-xxlarge">
		<option value="html">静态调用HTML</option>
		<option value="focus">焦点图调用</option>
		<option selected value="module">模块数据调用</option>
		<option value="sql">SQL数据调用</option>
		</select>
</TD>
<TR class="alltags moduletag">
	<TH>调用模块：</TH>
	<TD><select name="module" class="input-xxlarge">
		<option value="">--选择模块--</option>
		<volist name="callmodules" id="md">
		<option <?php if ($vo['module']==$md['name']){ ?>selected<?php };?> value="{$md['name']}"> {$md['title']} </option>
		</volist>
		</select>
</TD>
<TR class="alltags sqltag focustag moduletag">
	<TH>SQL条件：</TH>
	<TD><textarea class="input-xxlarge" style="float:left;" name="sqltxt" rows="7">{$vo.sqltxt}</textarea>
		<div style="float:left;margin-left:20px;">
			TIMESTAMP - 当前时间戳<br/>
			TODAYSTAMP - 当天零点时间戳<br/>
			MONTHSTAMP - 当月零点时间戳<br/>
			MONTHDAYS - 当月天数<br/>
			YEARSTAMP - 当年零点时间戳<br/>
			YEARDAYS - 当年天数
		</div></TD>
</TR>
<TR class="alltags focustag">
	<TH>焦点图样式：</TH>
	<TD><select name="focusstyle" class="input-xxlarge">
		<option value="">--选择样式--</option>
		<volist name="pattern" id="ptn">
		<option <?php if ($vo['focusstyle']==$ptn[value]){ ?>selected<?php };?> value="{$ptn[value]}"> {$ptn[text]} </option>
		</volist>
		</select>
</TD>
<TR class="alltags focustag">
	<TH>焦点图大小：</TH>
	<TD><INPUT TYPE="text" class="input-small" style="width: 105px;" NAME="focuswidth" value="960"> X <INPUT TYPE="text" class="input-small" style="width: 105px;" NAME="focusheight" value="300"> 像素</TD>
</TR>
<TR>
	<TH>模板文件：</TH>
	<TD><select name="tplfile" class="input-xxlarge">
		<option value="">--选择模板--</option>
		<volist name="tplfiles" id="tpl">
		<option <?php if ($vo['tplfile']==$tpl[name]){ ?>selected<?php };?> value="{$tpl[name]}"> {$tpl[title]} </option>
		</volist>
		</select> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(若输入模板HTML，则忽略选择的模板文件)
</TD>
<TR>
	<TH>模板HTML：</TH>
	<TD><textarea class="input-xxlarge" name="tplhtml" rows="5">{$vo.tplhtml}</textarea></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>调用条数(LIMIT)：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="recordcount" value="5"></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>排序方式(ORDER)：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="orderby" value="create_time DESC"></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>字段分组(GROUP)：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="groupby" value="{$vo.groupby}"></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>变量名：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="varname" value="{$vo.varname}"></TD>
</TR>
<TR>
	<TH>缓存名：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="cachename" value="{$vo.cachename}"></TD>
</TR>
<TR>
	<TH>缓存时间：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="cachetime" value="600"> 秒 (0则不缓存)</TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>标题字数：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="titlelen" value="0"></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>描述字数：</TH>
	<TD><INPUT TYPE="text" class="input-xxlarge" NAME="summarylen" value="0"></TD>
</TR>
<TR class="alltags sqltag focustag moduletag">
	<TH>缩略图大小：</TH>
	<TD><INPUT TYPE="text" class="input-small" style="width: 105px;" NAME="thumbwidth" value="220"> X <INPUT TYPE="text" class="input-small" style="width: 105px;" NAME="thumbheight" value="220"> 像素</TD>
</TR>
<TR>
	<TH>状态：</TH>
	<TD><SELECT class="input-xxlarge" NAME="status">
	<option <eq name="vo.status" value="1">selected</eq> value="1">启用</option>
	<option <eq name="vo.status" value="0">selected</eq> value="0">禁用</option>
	</SELECT></TD>
</TR>
<TR>
	<TH></TH>
	<TD class="center">
	<button type="submit" class="btn btn-primary">保 存</button>&nbsp;&nbsp;&nbsp;&nbsp;
	<button type="reset" onclick="window.location.href='{:U('Admin/Datacall/index')}'" class="btn btn-danger">取 消</button>		
	</TD>
</TR>
</TABLE>
</div>
</div>
</div>
</div>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
jQuery(document).ready(function(){
		setCallType('module');
		jQuery('.callcode').blur(function(){
				var code = jQuery('.callcode').val();
				var t = jQuery('.calltype').val();
				jQuery('.callmethod').html('&lt;datacall:'+t+' code="'+code+'" /&gt;');				
		});
});
function setCallType(t){
	var code = jQuery('.callcode').val();
	if(!t)t='html';
	jQuery('.alltags').hide();
	jQuery('.'+t+'tag').show();
	jQuery('.callmethod').html('&lt;datacall:'+t+' code="'+code+'" /&gt;');
}
</script>